home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Windows News 2005 November
/
WNnov2005.iso
/
Windows
/
Equipement
/
hMailServer
/
hMailServer-4.1-Build-136.exe
/
{app}
/
PHPWebAdmin
/
include
/
functions.php
< prev
Wrap
PHP Script
|
2005-04-04
|
4KB
|
171 lines
<?php
/*
** $Id: functions.php,v 1.5 2005/04/04 10:44:51 hmailserver Exp $
**
** hMailServer - Web interface
**
** File formatted using TAB size 4
**
** Get hMailserver at http://www.hmailserver.com
**
** Author: Steen Rab°l <srabol@mail.tele.dk>
** Copyright (c) 2004, Steen Rab°l <srabol@mail.tele.dk>
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** You may not change or alter any portion of this comment or credits
** of supporting developers from this source code or any supporting
** source code which is considered copyrighted (c) material of the
** original comment or credit authors.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
**
*/
function hmailGetVar($p_varname, $p_defaultvalue = null)
{
$retval = $p_defaultvalue;
if(isset($_GET[$p_varname]))
{
$retval = $_GET[$p_varname];
}
else if (isset($_POST[$p_varname]))
{
$retval = $_POST[$p_varname];
}
else if (isset($_COOKIE[$p_varname]))
{
$retval = $_COOKIE[$p_varname];
}
else if (isset($_SESSION[$p_varname]))
{
$retval = $_SESSION[$p_varname];
}
else if (isset($_REQUEST[$p_varname]))
{
$retval = $_REQUEST[$p_varname];
}
return $retval;
}
function hmailGetUserDomainName($username)
{
$atpos = strpos($username, "@");
$domain = substr($username, $atpos + 1);
return $domain;
}
define("ADMIN_USER", 0);
define("ADMIN_DOMAIN", 1);
define("ADMIN_SERVER", 2);
function hmailGetAdminLevel()
{
return $_SESSION["adminlevel"];
}
function hmailGetDomainID()
{
return $_SESSION["domainid"];
}
function hmailGetAccountID()
{
return $_SESSION["accountid"];
}
function hmailHackingAttemp()
{
global $hmailSmarty;
$hmailSmarty->assign("pagecontent", $hmailSmarty->fetch('permission_denied.tpl'));
$maintemplate = "index.tpl";
$hmailSmarty->display($maintemplate);
exit();
}
function hmailHasDomainAccess($domainid)
{
if (hmailGetAdminLevel() == 2)
return true;
if (hmailGetAdminLevel() == 1 && hmailGetDomainID() == $domainid)
return true;
return false;
}
function hmailLoadLanguage($p_langfile)
{
global $hmail_config;
//
// We don't want to re-invent the wheel, so we use Smarty's config class
//
if(!class_exists("Config_File"))
{
require_once( $hmail_config['includepath'] . 'smarty/Config_File.class.php');
}
if(file_exists($hmail_config['rootpath'] . 'language/' . $p_langfile))
{
$conf = new Config_File($hmail_config['rootpath'] . 'language/');
$conf->booleanize = false;
$hmail_config['langstrings'] = $conf->get($p_langfile);
}
}
function hmailGetLocaleText($text)
{
global $hmail_config;
if (!isset($hmail_config['langstrings'][$text]))
{
$hmail_config['langstrings'][$text] = "#$text# Missing - " . $hmail_config['langfile'];
}
return $hmail_config['langstrings'][$text];
}
function hmailTranslate($params, $content, &$smarty, &$repeat)
{
if (isset($content))
{
$lang = $params['lang'];
if($params['strip'])
{
$content = str_replace(" ", "_",$content);
$content = str_replace("/", "",$content);
$content = str_replace("-", "_",$content);
}
// do some translation with $content
return hmailGetLocaleText($content);
}
}
function hmailDumpVar($mixed='')
{
$var_type = gettype ($mixed);
echo "<p><table><tr><td bgcolor=ffffff><blockquote><font color=000090>";
echo "<pre><font face=arial>";
echo "<font color=800080><b>Variable Dump..</b></font>\n\n";
echo "\n\n<b>Type:</b> " . ucfirst($var_type) . "\n";
print_r(($mixed?$mixed:"<font color=red>No Value / False</font>"));
echo "</font></pre></font></blockquote></td></tr></table>";
echo "\n<hr size=1 noshade color=dddddd>";
}
?>